package cn.good.yan.basics.t2;

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

/**
 * 测试 - 操作数据库
 *   持久层框架 JPA
 *   1. 需要引包
 *         <!--spring-data-jpa的依赖-->
 *         <dependency>
 *             <groupId>org.springframework.boot</groupId>
 *             <artifactId>spring-boot-starter-data-jpa</artifactId>
 *         </dependency>
 *   2. yml 配置
 *      spring:
 *        datasource:
 *          url: jdbc:mysql://xx.xx.xx.xx:3306/xx?useSSL=false&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&failOverReadOnly=false&serverTimezone=Asia/Shanghai
 *          password: 用户名
 *          username: 密码
 *        jpa:
 *          generate-ddl: false
 *          show-sql: true  # 打印控制台SQL
 *          hibernate:
 *            ddl-auto: none
 *          open-in-view: true
 *          properties:
 *            enable_lazy_load_no_trans: true
 *            hibernate:
 *              dialect: org.hibernate.spatial.dialect.mysql.MySQL56InnoDBSpatialDialect
 *      # 日志配置
 *      logging:
 *         evel:
 *           root: info
 *           org.hibernate: info
 * @author shengren.yan
 * @create 2022-11-24
 */
@SpringBootTest
public class testJPA {

    // CommentRepository
    // UserRepository

    // 1 测试注解版 的CURD
    @Test
    void test1() {
        // jpa 可以自动生成SQL
        // userRepository.flush();  新增后，查询没有看到，强制刷新
    }

}
